<!--异常处理历史记录-->
<template>
  <div class="app-container">
    <ht-search-form
      v-show="showSearch"
      :dictMap="dictMap"
      :labelWidth="100"
      :queryParams="queryParams"
      :outputQueryParams="queryParams"
      :formOptions="formOptions"
      :advOptions="[]"
      :defaultEventKey="defaultEventKey"
    ></ht-search-form>
    <ht-table
      ref="dataTable"
      rowKey="id"
      :showSerialNumber="false"
      :multi-select="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
      :opButtonList="opButtonList"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="left" width="100px" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '查看明细',
                  doFunc: () => {
                    detail(scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>

    <exception-handling-history-query-dialog
      ref="exceptionHandlingHistoryQueryDialog"
      @editComplete="editComplete"
    ></exception-handling-history-query-dialog>
  </div>
</template>
<script>
import { historyQueryUrlConfig } from "@/api/cnaps/bizMng/exceptionHandling.js";
import { listPageMixin } from "@/libs/listPageMixin";
import ExceptionHandlingHistoryQueryDialog from "./dialog";

export default {
  name: "exceptionHandling_historyQuery",
  mixins: [listPageMixin],
  components: {
    ExceptionHandlingHistoryQueryDialog,
  },
  props: {},
  data() {
    return {
      reqConfig: historyQueryUrlConfig,
      defaultEventKey: "",
      //数据字典
      searchFormDictList: ["SYSTEMCODE", "EXCEPTION_TYPE", "DRCTCODE", "EXCEPTION_STATUS", "EXCEPTION_OPTYPE"],
      // 遮罩层
      loading: true,
      // 弹出层标题
      title: "",
      showSearch: true,
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        id:"",
        txnId:'',
        drct:'',
        exceptionType:'',
        status:'',
        cpgdate:'',
        cpgdate2:'',
        workdate:"",
        workdate2:"",
      },
      formOptions: [],
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        { label: `交易流水号`, prop: "id", width: "200px", align: "center" },
        { label: `原交易流水号`, prop: "txnId", width: "200px", align: "center" },
        { label: `工作日期`, prop: "workdate", align: "center" },
        { label: `CPG日期`, prop: "cpgdate", align: "center" },
        { label: `系统编号`, prop: "sysCode", width: "160px", align: "center", dictCode: "SYSTEMCODE" },
        {
          label: `报文类型`,
          prop: "pkgNo",
          formatter(row, text, index) {
            return row["pkgNo"] + "-" + row["pkgNoDesc"];
          },
          width: "260px",
          align: "center",
        },
        { label: `来往账标识`, prop: "drct", align: "center", sortable: false, dictCode: "DRCTCODE" },
        { label: `异常类型`, prop: "exceptionType", width: "200px", align: "center", dictCode: "EXCEPTION_TYPE" },
        { label: `通讯级标识号`, prop: "msgId", width: "160px", align: "center" },
        { label: `发送/接收时间`, prop: "sndRcvTime", width: "160px", align: "center", type: "date" },
        { label: `异常处理状态`, prop: "status", align: "center", dictCode: "EXCEPTION_STATUS",fixed: "right"},
      ],
    };
  },
  mounted() {
    this.formOptions = [
      {
        type: "input",
        prop: "id",
        defaultAttr: {
          label: "交易流水号",
          placeholder: "请输入交易流水号",
        },
      },
      {
        type: "input",
        prop: "txnId",
        defaultAttr: {
          label: "原交易流水号",
          placeholder: "请输入原交易流水号",
        },
      },
      {
        type: "dict",
        dict: "DRCTCODE",
        prop: "drct",
        defaultAttr: {
          label: "来往账标识",
          placeholder: "请选择来往账标识",
        },
      },

      {
        type: "dict",
        dict: "EXCEPTION_STATUS",
        prop: "status",
        defaultAttr: {
          label: "异常处理状态",
          placeholder: "请选择异常处理状态",
        },
      },
      {
        type: "dates",
        nameObj: {
          startTimeName: "cpgdate",
          endTimeName: "cpgdate2",
        },
        defaultAttr: {
          label: "CPG日期",
          placeholder: ["CPG开始日期", "CPG结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },
      {
        type: "dates",
        nameObj: {
          startTimeName: "workdate",
          endTimeName: "workdate2",
        },
        defaultAttr: {
          label: "工作日期",
          placeholder: ["工作开始日期", "工作结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },
      {
        type: "dict",
        dict: "EXCEPTION_TYPE",
        prop: "exceptionType",
        defaultAttr: {
          label: "异常类型",
          placeholder: "请选择异常类型",
        },
      },
    ];
  },
  methods: {
    /** todo 查询当天操作员的交易记录 */
    getList() {
      this.doQuery();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    detail(row) {
      console.log("this.$refs.exceptionHandlingHistoryQueryDialog", this.$refs.exceptionHandlingHistoryQueryDialog);
      this.$refs.exceptionHandlingHistoryQueryDialog.show(row);
    },
    editComplete(state) {
      console.log("editComplete", state);
      if (state == true) {
        this.getList();
      }
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}
</style>
